{include file="common/_header"}
{include file="common/_header1"}

<body class="layui-anim layui-anim-up">

<div class="x-body">

    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
            <form class="layui-form layui-col-md12 x-so">
                <div class="layui-input-inline">
                    <input type="text" name="paper_id" style="display:none;" value="{$data.get.paper_id}" autocomplete="off" class="layui-input">
                    <div class="layui-unselect layui-form-select shop_id" style="display:inline-block;">
                        <input type="text" name="user_name"  placeholder="请输入用户名" value="{$data.get['user_name']}" autocomplete="off" class="layui-input">
                    </div>
                    <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                </div>
            </form>
        </form>
    </div>



    <table id="tables" class="layui-table">

        <thead>
        <tr>
            <th>id</th>
            <th>用户名</th>
            <th>头像</th>
            <th>时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="data.data" id="vo"}
        <tr class="table_tr">
            <td>{$vo.user_id}</td>
            <td>{$vo.nick_name}</td>
            <td><img src="{$vo.avatar}"></td>
            <td>{$vo.add_time|date="Y-m-d H:i:s"}</td>
            <td>
                <span class="status_span" style="cursor: pointer;background: dodgerblue;" onclick="x_admin_show('查看答题信息', 'useranswers?user_id={$vo.user_id}&paper_id={$vo.at_id}',800,600)" href="javascript:;">查看</span>
            </td>

        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page_all">
        {$page|raw}
    </div>
</div>
<script>

    $(function () {
        // 表格选中行的同时选中单选框
        $("#tables tr:gt(0)").click(function () {
            $(this).find(":radio").prop("checked", true);
        });

    });

    //js放到table下，才能检测到tr数组
    var trs = document.getElementById("tables").getElementsByTagName("tr");
    $(function () {
        for (var i = 0; i < trs.length; i++) {
            trs[i].onmousedown = function () {
                mousedownclick(this);
            }
        }
    });

    function mousedownclick(obj) {
        for (var j = 0; j < trs.length; j++) {
            if (trs[j] == obj) {
                if (trs[0] != obj) {
                    trs[j].style.background = '#D0E9C6';
                    // 启用新增和编辑按钮
                    $("#edits").removeAttr("disabled");//启用按钮
                    $('#edits').removeClass('layui-disabled');
                }
            } else {
                trs[j].style.background = '';
            }
        }
    }
</script>
</body>

{include file="common/_bottom"}